package cn.bdqn.controller;

import cn.bdqn.pojo.Salary;
import cn.bdqn.service.SalaryService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.List;

@Controller
@RequestMapping("/salary")
public class SalaryController {

    @Resource
    private SalaryService salaryService;

    @RequestMapping("showAs")
    public  String showAs( Model model){
        List<Salary> salary = salaryService.showAs();
        model.addAttribute("salary",salary);
        return "salary-management";
    }

    @RequestMapping("addS")
    public String addS(Salary s){
        int flag=salaryService.addS(s);
        if(flag == 1) {
            return "redirect:/salary/addS";
        }else {
            return "salary-management.html";
        }
    }
    
    
}
